// 获取当前用户权限状态
export const getSetting = () => {
    return new Promise((resolve, reject) => {
        wx.getSetting({
            success: (result) => {
                resolve(result)
            },
            fail: (err) => {
                reject(err)
            }
        });
    })
}
// 获取用户收货地址
export const chooseAddress = () => {
    return new Promise((resolve, reject) => {
        wx.chooseAddress({
            success: (result) => {
                resolve(result)
            },
            fail: (err) => {
                reject(err)
            }
        });
    })
}

// 开启授权收货地址页面
export const openSetting = () => {
    return new Promise((resolve, reject) => {
        wx.openSetting({
            success: (result) => {
                resolve(result)
            },
            fail: (err) => {
                reject(err)
            }
        });
    })
}
// 开启弹窗判断
export const showModal = ({content}) => {
    return new Promise((resolve, reject) => {
        wx.showModal({
            title: '提示',
            content,
            success: (result) => {
                resolve(result)
            },
            fail: (err) => {
                reject(err)
            }
        });
    })
}
// 开启弹窗
export const showToast = ({title}) => {
    return new Promise((resolve, reject) => {
        wx.showToast({
            title,
            icon: "none"
        });
    })
}
// 获取登陆状态
export const login = () => {
    return new Promise((resolve, reject) => {
       wx.login({
           timeout:10000,
           success: (result)=>{
            resolve(result)
           },
           fail: (err)=>{reject(err)},
       });
    })
}